import request from '@/config/axios'
import type {SaveUserRoleResponse} from '@/model/role-import'

export const saveRoleApi = (data: SysRole) => {
	return request.post({
		url: '/system/sys-role/saveRole',
		data
	})
}

export const deleteRoleApi = (id: number) => {
	return request.delete({
		url: '/system/sys-role/deleteRole/' + id
	})
}

export const getUserRoleInfoApi = (roleId: number) => {
	return request.get<UserRoleInfo>({
		url: '/system/sys-role/readOnly/getUserRoleInfo/' + roleId
	})
}

export const saveUserRoleApi = (data: { roleId: number, userIdList: number[] }) => {
	return request.post<SaveUserRoleResponse | undefined>({
		url: '/system/sys-role/saveUserRole',
		data
	})
}
